[1/6] mdio_bus: Add generic mdio_find_bus()
authorJeremy Linton <jeremy.linton@arm.com>
Mon, 24 Feb 2020 22:53:58 +0000 (16:53 -0600)
committerBen Hutchings <benh@debian.org>
Tue, 9 Jun 2020 17:50:00 +0000 (18:50 +0100)
commitb7b03a8da38f7285a4e55875e92d84f302009f76
treee53988a35ba4c96075f62009efbff709e83ad0fd
parent1d1b10dbb81009dd061c52185e0dac245528a64a
[1/6] mdio_bus: Add generic mdio_find_bus()

Origin: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit?id=ce69e2162f158d9d4a0e513971d02dabc7d14cb7
Bug-Debian: https://bugs.debian.org/950578

It appears most ethernet drivers follow one of two main strategies
for mdio bus/phy management. A monolithic model where the net driver
itself creates, probes and uses the phy, and one where an external
mdio/phy driver instantiates the mdio bus/phy and the net driver
only attaches to a known phy. Usually in this latter model the phys
are discovered via DT relationships or simply phy name/address
hardcoding.

This is a shame because modern well behaved mdio buses are self
describing and can be probed. The mdio layer itself is fully capable
of this, yet there isn't a clean way for a standalone net driver
to attach and enumerate the discovered devices. This is because
outside of of_mdio_find_bus() there isn't a straightforward way
to acquire the mii_bus pointer.

So, lets add a mdio_find_bus which can return the mii_bus based
only on its name.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Gbp-Pq: Topic features/all/bcmgenet
Gbp-Pq: Name 0001-mdio_bus-Add-generic-mdio_find_bus.patch
drivers/net/phy/mdio_bus.c
include/linux/phy.h